#!/bin/bash

set -e
set -x

# wget https://github.com/Altinity/clickhouse-backup/releases/download/v2.6.5/clickhouse-backup-linux-amd64.tar.gz
bypy download clickhouse-backup-linux-amd64.tar.gz
tar xf clickhouse-backup-linux-amd64.tar.gz
cp build/linux/amd64/clickhouse-backup /usr/local/bin/
mkdir -p /etc/clickhouse-backup
cp config.yml /etc/clickhouse-backup/
clickhouse-backup tables
# 备份数据
# clickhouse-backup create -t db1.table1 db1_table1_backup
# 查看备份数据
# clickhouse-backup list
# 增量恢复数据（重复执行会导致重复数据）
# clickhouse-backup restore db1_table1_backup -d
# 清空数据重建表恢复数据
# clickhouse-backup restore db1_table1_backup

set +x
set +e

